/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Model;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author PaolaRestrepo
 */
@Entity
@Table(name = "pagos")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Pagos.findAll", query = "SELECT p FROM Pagos p"),
    @NamedQuery(name = "Pagos.findByIdPago", query = "SELECT p FROM Pagos p WHERE p.idPago = :idPago"),
    @NamedQuery(name = "Pagos.findByFecha", query = "SELECT p FROM Pagos p WHERE p.fecha = :fecha"),
    @NamedQuery(name = "Pagos.findByMontoPagar", query = "SELECT p FROM Pagos p WHERE p.montoPagar = :montoPagar"),
    @NamedQuery(name = "Pagos.findByCuotasFaltantes", query = "SELECT p FROM Pagos p WHERE p.cuotasFaltantes = :cuotasFaltantes"),
    @NamedQuery(name = "Pagos.findByCuotasPagados", query = "SELECT p FROM Pagos p WHERE p.cuotasPagados = :cuotasPagados"),
    @NamedQuery(name = "Pagos.findBySaldo", query = "SELECT p FROM Pagos p WHERE p.saldo = :saldo")})
public class Pagos implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "idPago")
    private Integer idPago;
    @Basic(optional = false)
    @NotNull
    @Column(name = "fecha")
    @Temporal(TemporalType.DATE)
    private Date fecha;
    @Basic(optional = false)
    @NotNull
    @Column(name = "monto_pagar")
    private long montoPagar;
    @Basic(optional = false)
    @NotNull
    @Column(name = "cuotasFaltantes")
    private int cuotasFaltantes;
    @Basic(optional = false)
    @NotNull
    @Column(name = "cuotasPagados")
    private int cuotasPagados;
    @Basic(optional = false)
    @NotNull
    @Column(name = "saldo")
    private long saldo;
    @JoinColumn(name = "idCredito", referencedColumnName = "idCredito")
    @ManyToOne(optional = false)
    private Creditos idCredito;

    public Pagos() {
    }

    public Pagos(Integer idPago) {
        this.idPago = idPago;
    }

    public Pagos(Integer idPago, Date fecha, long montoPagar, int cuotasFaltantes, int cuotasPagados, long saldo) {
        this.idPago = idPago;
        this.fecha = fecha;
        this.montoPagar = montoPagar;
        this.cuotasFaltantes = cuotasFaltantes;
        this.cuotasPagados = cuotasPagados;
        this.saldo = saldo;
    }

    public Integer getIdPago() {
        return idPago;
    }

    public void setIdPago(Integer idPago) {
        this.idPago = idPago;
    }

    public Date getFecha() {
        return fecha;
    }

    public void setFecha(Date fecha) {
        this.fecha = fecha;
    }

    public long getMontoPagar() {
        return montoPagar;
    }

    public void setMontoPagar(long montoPagar) {
        this.montoPagar = montoPagar;
    }

    public int getCuotasFaltantes() {
        return cuotasFaltantes;
    }

    public void setCuotasFaltantes(int cuotasFaltantes) {
        this.cuotasFaltantes = cuotasFaltantes;
    }

    public int getCuotasPagados() {
        return cuotasPagados;
    }

    public void setCuotasPagados(int cuotasPagados) {
        this.cuotasPagados = cuotasPagados;
    }

    public long getSaldo() {
        return saldo;
    }

    public void setSaldo(long saldo) {
        this.saldo = saldo;
    }

    public Creditos getIdCredito() {
        return idCredito;
    }

    public void setIdCredito(Creditos idCredito) {
        this.idCredito = idCredito;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idPago != null ? idPago.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Pagos)) {
            return false;
        }
        Pagos other = (Pagos) object;
        if ((this.idPago == null && other.idPago != null) || (this.idPago != null && !this.idPago.equals(other.idPago))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Model.Pagos[ idPago=" + idPago + " ]";
    }
    
}
